<@realgodo.admin_html>
<div class="title">
	<h1><#if constellation?exists&&constellation.id?exists>编辑<#else>添加</#if>星座</h1>
	<span class="tTip">标注"<em>*</em>"为必填项</span>
</div>
<div class="box">
	<div class="inner">
		<div class="tx_table">
			<h2><#if constellation?exists&&constellation.id?exists>编辑<#else>添加</#if>星座</h2>
			<form name="saveForm" id="saveForm" action="${base}/admin/constellation/index!save" method="post">
			<div class="data">
				<table>
					<colgroup width="24%"></colgroup>
					<tbody>
						<tr>
							<th><em>*</em>星座名称：</th>
							<td>
								<input class="Q" type="text" name="constellation.name" id="name" size="32" value="${(constellation.name)!}"/>
								<span id="nameTip"></span>
							</td>
						</tr>
						<tr>
							<th><em>*</em>英文名称：</th>
							<td>
								<input class="Q" type="text" name="constellation.en_name" id="en_name" size="32" value="${(constellation.en_name)!}"/>
								<span id="en_nameTip"></span>
							</td>
						</tr>
						<tr>
							<th><em>*</em>开始时间：</th>
							<td>
								<select name="constellation.startMonth" id="startMonth" onchange="setEndMonth(this.value)">
									<#list 1..12 as month>
										<#if constellation.startMonth == month>
										<option value="${month}" selected="selected">${month}月</option>
										<#else>
										<option value="${month}">${month}月</option>
										</#if>
									</#list>
								</select>
								&nbsp;&nbsp;&nbsp;&nbsp;
								<select name="constellation.startDay" id="startDay">
									<#list 1..31 as day>
										<#if constellation.startDay == day>
										<option value="${day}" selected="selected">${day}日</option>
										<#else>
										<option value="${day}">${day}日</option>
										</#if>
									</#list>
								</select>
							</td>
						</tr>
						<tr>
							<th><em>*</em>结束时间：</th>
							<td>
								<input class="Q" type="text" name="constellation.endMonth" id="endMonth" size="1" value="${(constellation.endMonth)!}" readonly="true" maxLangth="2"/>月
								&nbsp;&nbsp;&nbsp;&nbsp;
								<select name="constellation.endDay" id="endDay">
									<#list 1..31 as day>
										<#if constellation.endDay == day>
										<option value="${day}" selected="selected">${day}日</option>
										<#else>
										<option value="${day}">${day}日</option>
										</#if>
									</#list>
								</select>
							</td>
						</tr>
						<tr>
							<th>详细内容：</th>
							<td><div id="news_content"><textarea name="constellation.comment">${(constellation.comment)!}</textarea></div></td>
						</tr>
					</tbody>
				</table>
				<div class="tx_sender">
						<input class="step" type="submit" value="保 存" title="保 存"/>
						<input class="step" type="reset" value="重置" title="重置"/>
						<input class="step" type="button" value="返回列表" title="返回列表" onclick="javascript:location.href='${base}/admin/constellation/'"/>
						<#if constellation?exists&&constellation.id?exists>
						<input type="hidden" name="constellation.id" value="${(constellation.id?c)!}" />
						</#if>
				</div>
			</div>
			</form>
		</div>
	</div>
</div>
<script type="text/javascript">

	window.onload = function() {	
		var oFCKeditor = new FCKeditor( 'constellation.comment' ) ;
		oFCKeditor.BasePath = "${statics}/plugins/editor/fckeditor/"
		oFCKeditor.ReplaceTextarea() ;
	}

	function setEndMonth(v){
		var startMonth=parseInt(v,10);
		if(startMonth<12){
			document.getElementById('endMonth').value=(startMonth+1);
		}else{
			document.getElementById('endMonth').value=1;
		}
	}
	
	$(document).ready(function(){
		$.formValidator.initConfig({formid:"saveForm",onerror:function(msg){},onsuccess:function(){return true;}});					
			
		$("#name")
		.formValidator({onshow:"请输入星座名称",onfocus:"请输入星座名称",oncorrect:"星座中文名称正确"})
		.inputValidator({min:2,max:6,empty:{leftempty:false,rightempty:false,emptyerror:"星座中文名称两边不能有空符号"},onerror:"星座中文名称为2-3位汉字,请确认"})
		.regexValidator({regexp:"^[\\u4E00-\\u9FA5\\uF900-\\uFA2D]{2,3}$",onerror:"星座名称为2-4个中文"});
		
		$("#en_name").formValidator({onshow:"请输入星座英文名称",onfocus:"请输入星座英文名称",oncorrect:"英文名称输入正确"})
		.inputValidator({min:1,onerror:"英文名称不能为空"})
		.regexValidator({regexp:"^[a-zA-Z ]{2,40}$",onerror:"星座英文名称名为2-40个英文字母"});
		
	});
	
</script>
</@realgodo.admin_html>